#include <iostream>
#define N 100

using namespace std;

void readintVector(int array[], int elements){
for (int i=0; i<elements; i++){
	cout<<"a["<<i<<"]=";
	cin>>array[i];
	cout<<"\n";}
}

void printintVector(int array[], int elements){
for (int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
	cout<<"\n";
}

int perm_left(int array[], int elements){
int i, j, aux;
for(i=0; i<elements; i++){
	j=i+1;
	if(j==elements)
		j=0;	
	aux=array[j];
		
	while(j!=i){
		if (j==elements-1){
			array[j]=array[0];
			j=0;
		}
		else {
			array[j]=array[j+1];
			++j;
			}	
	}
	array[i]=aux;
	printintVector(array, elements);
	}
}

int main(){
int array[N];
int elements;
cout<<"Type the number of elements you want in the array: ";
cin>>elements;

readintVector(array, elements);

cout<<"The original array is ";
for(int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
cout<<endl;
cout<<"The permutations with one position to the left are: "<< endl;
perm_left(array, elements);

return 0;
}
